from config.session_manager import get_session
from api.college_api import fetch_all_college_data
from utils.save import save_to_json
from api.major import fetch_all_major_data
from api.admission import fetch_admission_data


def main():
    try:
        session = get_session()
        # 爬取大学
        # colleges = fetch_all_college_data(session)
        # 爬取专业
        # majors = fetch_all_major_data(session)
        # 爬取历年录取率
        admissions = fetch_admission_data(session)
        save_to_json(admissions, "data/admissions_烹饪类.json")
        # save_to_json(colleges, 'data/colleges.json')
    except Exception as e:
        print(f"运行出错: {e}")


if __name__ == "__main__":
    main()
